package com.example.hehecat.yuejian1.mvp.presenter;

import android.content.Context;

import com.example.hehecat.yuejian1.mvp.contract.MasterListContract;
import com.example.hehecat.yuejian1.mvp.model.MasterListModel;
import com.example.hehecat.yuejian1.mvp.model.bean.MasterBean;

import java.util.List;

import rx.Subscriber;

public class MasterListPresenter implements MasterListContract.Presenter {
    private MasterListContract.View view;
    private MasterListContract.Model model;

    public MasterListPresenter(MasterListContract.View view) {
        this.view = view;
        model = new MasterListModel();
    }

    @Override
    public void updateAdapterData() {
        model.getAllMasterData(new Subscriber<List<MasterBean>>() {
            @Override
            public void onCompleted() {

            }

            @Override
            public void onError(Throwable e) {

            }

            @Override
            public void onNext(List<MasterBean> masterBeans) {
                view.updateAdapterData(masterBeans);
            }
        });
    }
}
